import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import { isNoAuth } from 'src/utils/decorator/jwt.decorator';
import { AuthService } from './auth.service';
import { UserInfoDto } from 'src/userInfo/dto/userinfo.dto';
import { query } from 'express';

@ApiTags('用户管理')
@Controller('auth')
@isNoAuth()
export class AuthController {
  constructor(private readonly authService: AuthService) {}
  @ApiOperation({
    summary: '登录',
  })
  @Post('login')
  async login(@Query() query) {
    return await this.authService.login(query);
  }
  @ApiOperation({
    summary: '获取Code',
  })
  @Get('getCode')
  async getCode() {
    return await this.authService.getCode();
  }

  @ApiOperation({
    summary: '获取用户信息',
  })
  @Get('getInfo')
  async getInfo(@Query() query) {
    return await this.authService.getInfo(query);
  }
}
